package com.hl.toolkit.server.tycoin.trate.slaverepository;

import com.tycoin.common.repository.AbstractRepository;
import com.tycoin.trate.slaveentity.TycoinTradeOrder;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TycoinTradeOrderRepository  extends AbstractRepository<TycoinTradeOrder, Long> {

	//根据支付方式查询每一种支付方式一天发生的交易金额
	
 	@Query("select t from TycoinTradeOrder t  WHERE t.userId=:userId      and     t.coinType=:coinType  and status=:status  ORDER BY paymentTime DESC  ")
 	Page<TycoinTradeOrder> getTycoinTradeOrderForCoinType(@Param("coinType") String coinType, @Param("userId") String userId, @Param("status") int status, Pageable pageable);


 	@Query("select t from TycoinTradeOrder t  WHERE     t.coinType=:coinType  and status=:status  ORDER BY paymentTime DESC  ")
 	List<TycoinTradeOrder> getTycoinTradeOrderForCoinTypeList(@Param("coinType") String coinType, @Param("status") int status);




 	@Query("select t from TycoinTradeOrder t  WHERE t.userId=:userId      and     t.coinType=:coinType      ORDER BY paymentTime DESC  ")
 	Page<TycoinTradeOrder> getTycoinTradeOrderForSize(@Param("coinType") String coinType, @Param("userId") String userId, Pageable pageable);
	
	
}
